var admin_url = 'http://192.168.0.108:8772';
var pj_name = "kvm-manger";
if(window.sessionStorage.getItem(pj_name+'-token')) {
	var token = window.sessionStorage.getItem(pj_name+'-token');
	var tokenId = window.sessionStorage.getItem(pj_name+'-suser');
	var userId = eval('(' + tokenId + ')').id;
}

function myConfirm(content, func) {
	layer.confirm(content, func);
};

function request_ajax2(type, url, data) {
	$.ajax({
		"type": type,
		"xhrFields": {
			withCredentials: true
		},
		"url": url,
		"data": data,
		"async": true
	})
}
// 检查登录状态
    $(function(){
        
    })
// 将富文本设置为只读模式.....
function contenteditable(){
	$(window.frames["LAY_layedit_1"].document).find('body').attr("contenteditable",false);
	$(window.frames["LAY_layedit_3"].document).find('body').attr("contenteditable",false);
	$(window.frames["LAY_layedit_2"].document).find('body').attr("contenteditable",false);
}
function partitionStatus(idName){
	$.ajax({
		type: 'post',
		xhrFields: { withCredentials: true },
		url: admin_url + '/kvmProductPartition/productPartitions',
		data: { tokenUserId: userId, token: token },
		success: function (data) {
			if (data.code == 200 && data.data != null) {
				var leng = data.data.length;
				for (var i = 0; i < leng; i++) {
					$("#" + idName).append('<option value = "' + data.data[i].id + '">' + data.data[i].name + '</option>')
				}
			} else {
				layer.msg(data.msg, {
					time: 1500
				})
			}
		}
	})
}
function request_ajax(type, url, data, successFuc, successAfterFuc) {
	$.ajax({
		"type": type,
		"xhrFields": {
			withCredentials: true
		},
		"url": url,
		"data": data,
		"async": true,
		//请求成功后的回调
		"success": function(result) {
			if(successFuc) {
				//自定义处理
				return successFuc(result);
			} else {
				//默认处理调用成功提示信息
				layer.msg(result.msg, {
					time: 800,
					end: function() {
						if(successAfterFuc) {
							return successAfterFuc();
						} else {
							return null;
						}
					}
				});
			}
		}
	})
}

function pager() {}